<template>
  <div>
    <div
      class="card"
      @click="router.push('/repair/detail?id=' + item.id + '&type=home')"
      v-for="item in list"
      :key="item.id"
    >
      <div class="card_repair" v-if="item.status === 0">待维修</div>
      <div class="card_repair_grey" v-else>已维修</div>
      <div class="card_title">{{ item.repairTypeName }}</div>
      <div class="card_content ellipsisStyle">
        <svg-icon icon-class="address" />
        <span>{{ item.buildingLocationName }}/{{ item.roomLocationName }}</span>
      </div>
      <div class="card_content">
        <svg-icon icon-class="time" />
        <span>{{ dayjs(item.createTime).format("YYYY-MM-DD hh:mm") }}</span>
      </div>
      <div class="card_word ellipsisStyle">{{ item.repairDesc }}</div>
    </div>
  </div>
</template>

<script setup lang="ts">
import router from "@/router";
import * as dayjs from "dayjs";
defineProps({
  list: Array,
});
</script>

<style lang="less" scoped>
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: 10px;
  background-color: #ffffff;
  margin-bottom: 16px;
  .card_repair,
  .card_repair_grey {
    position: absolute;
    padding: 1px 10px;
    right: 0;
    top: 0;
    background: #fe922a;
    border-radius: 0px 10px 0px 10px;
    font-size: 12px;
    font-weight: 400;
    color: #ffffff;
    line-height: 22px;
    letter-spacing: 1px;
  }
  .card_repair_grey {
    background: rgba(220, 220, 220, 1);
    color: rgba(255, 255, 255, 1);
  }
  .card_title {
    font-size: 16px;
    font-weight: 600;
    color: #303233;
    line-height: 24px;
    margin-bottom: 14px;
  }
  .card_content {
    margin-bottom: 12px;
    font-size: 14px;
    color: #616366;
    line-height: 22px;
    svg {
      margin-right: 11px;
    }
  }
  .card_word {
    font-size: 14px;
    color: #616366;
    line-height: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }
}
</style>
